<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- <input :type="bool ? 'password' : 'text' ">
        <button @click="bool = !bool">{{bool ? "明文":"加密" }}</button> -->
        <ul>
            <!-- item(变量名) in(固定) arr(数组名)  -->
            <li @click="fn(index)" v-for="(item,index) in arr" :key="item.birth">
                {{item.name}}
                <input type="text">
            </li>
        </ul>
        <button @click="addFn">点击添加人物</button>
    </div>
    <script src="../vue2.js"></script>
    <script>
        const vm = new Vue({
            el:'#app',
            data(){
                return {
                    bool: true,
                    arr: [
                        {name: '洛璃', birth: 18},
                        {name: '云璃', birth: 17},
                        {name: '梦璃', birth: 19}
                    ],
                    person: {name: 'luoli'}
                }
            },
            methods:{
                fn(index){
                    console.log(this.arr[index]);
                },
                addFn(){
                    this.arr.push({name: '光光',birth: 20})
                    this.$set(this.person,'age',18)
                }
            }
        })
        // Vue.set(vm.person,'age',18)
    </script>
</body>
</html>